oo::class create MethodsView {
    superclass TreeView
    variable Lbf Tree Type Cls

    constructor {args} {
        next {*}[list {*}$args {ids}]
        my redefineHilightVariable
        my redefineOnNotebookTabChanged
        my redefineHilightPadInAccelerator
    }

    method redefineOnNotebookTabChanged {} {
        foreach {vars body} [info class definition ::FilesNotebook onNotebookTabChanged] {
            append body \n
            append body "[self] populateRoots $Tree"
            append body \n
            oo::define ::FilesNotebook method onNotebookTabChanged $vars $body
        }
    }

    method redefineHilightPadInAccelerator {} {
        foreach {vars body} [info class definition ::Accelerator hilightPad] {
            append body \n
            append body "[self] populateRoots $Tree"
            append body \n
            oo::define ::Accelerator method hilightPad $vars $body
        }
    }

    method redefineHilightVariable {} {
        foreach {vars body} [info class definition ::Variable hilightVariable] {
            append body \n
            append body "[self] populateRoots $Tree"
            append body \n
            oo::define ::Variable method hilightVariable $vars $body
        }
    }

    method populateRoots {tree} {
        set fnb [lindex [info class instances ::FilesNotebook] 0]
        set cur [$fnb getCurrentPad]
        if {$cur == {}} {return}
        array set methods {}
        foreach {h t} [_$cur tag ranges Proc] {
            array set methods [list [_$cur get $h $t] [list $h $t]]
        }
        $tree delete [$tree children {}]
        foreach n [lsort [array names methods]] {
            $tree insert {} end -text $n -values [list $methods($n)]
        }
    }

    method openSelected {fnb tree node} {
        set cur [$fnb getCurrentPad]
        _$cur tag remove search 1.0 end
        foreach {h t} [$tree set $node ids] {
            _$cur mark set insert $h
            _$cur see insert
            _$cur tag add search $h $t
        }
    }
}